﻿using Confluent.Kafka;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;

namespace EventBus.Kafka
{
    /// <summary>
    /// Kafka 配置
    /// </summary>
    public class KafkaOptions : IOptions<KafkaOptions>
    {
        /// <summary>
        /// kafka 链接地址
        /// </summary>
        public string BootstrapServers { get; set; }

        /// <summary>
        /// 消费者组Id，Id相同就表示在同一消费者组中
        /// </summary>
        public string GroupId { get; set; }

        /// <summary>
        /// 消息确认
        /// </summary>
        public Acks Acks { get; set; }
       
        /// <summary>
        /// 发送消息到分区，消息发送策略
        /// </summary>
        public Partitioner Partitioner { get; set; }

        /// <summary>
        /// 消费者:是否自动确认消息   
        /// </summary>
        public bool EnableAutoCommit { get; set; }

        /// <summary>
        /// 消息Offset 偏移量
        /// </summary>
        public AutoOffsetReset AutoOffsetReset { get; set; }

        public KafkaOptions Value => this;
    }
}
